<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layuimini-main">

        <form class="layui-form" action="">

            <div class="layui-form-item">
                <label class="layui-form-label">团队名称</label>
                <div class="layui-input-block">
                    <input type="text" name="title" value="" lay-verify="title" autocomplete="off" placeholder="请输入团队名称" class="layui-input iwidth" aria-disabled="true">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" maxlength="11" autocomplete="off"  lay-verify="phone" placeholder="请根据手机号搜索玩家信息" class="layui-input iwidth">
                </div>
            </div>
            <div class="layui-inline">
                <button  class="layui-btn layui-btn-primary" lay-submit="" lay-filter="add" lay-filter="layui-btn"><i class="layui-icon"></i> 搜 索</button>
            </div>

        </form>

    </div>
</div>

{include file="public/footer" /}

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate','wangEditor'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , wangEditor = layui.wangEditor
            , $ = layui.jquery;
        // 监听全选
        form.on('checkbox(checkall)', function (data) {
            console.log(data);
            if (data.elem.checked) {
                $('.checkboxs').prop('checked', true);
            } else {
                $('.checkboxs').prop('checked', false);
            }
            form.render('checkbox');
        });

        $(this).removeAttr("lay-key");//时间框一点就消失处理
        // 上架开始日期
        var insShelf = laydate.render({
            elem: '#create_time'
            , min: 0
            , trigger : 'click'//时间框一点就消失处理
            , calendar: true
            , type: 'datetime'
            , done: function (value, date) {
             /*   //更新结束日期的最小日期
                insUnder.config.min = lay.extend({}, date, {
                    month: date.month - 1
                });*/

                //自动弹出结束日期的选择器
                //insUnder.config.elem[0].focus();
            }
        });
        form.on('radio(radio)', function(data){
            if(data.value == 1){
                //独立匹配
                document.querySelector("#checkbox").style.display='none';
            }else if(data.value == 2){
                //综合匹配
                document.querySelector("#checkbox").style.display='block';
            }

        });
        //自定义验证规则
        form.verify({
            title: function (value) {
                if (value == '') {
                    return '团队名称不能为空';
                }
            },
            phone: function (value) {
                if (value == '') {
                    return '请填写你要搜索的手机号!';
                }
            }
            , content: function (value) {
                layedit.sync(editIndex);
            }
        });

        //监听指定开关
        form.on('switch(switchTest)', function (data) {
            layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //监听提交修改
        form.on('submit(add)', function (data) {
            let  postdata =data.field
            let  phone =data.field.phone
            let  teamTitle =data.field.title
            var index = layer.open({
                title:'团队创建',
                type: 2,
                area: ['100%', '100%'],
                fixed: false, //不固定
                shade:0.5,
                shadeClose:true,
                content: '/admin/team/getMember?type=teamCreate&teamTitle='+teamTitle+'&phone='+phone,
            });
            return false;

        });


    });
    //查看用户信息
    function clickMember(memberCode){
        var index = layer.open({
            title:'领导人信息',
            type: 2,
            area: ['95%', '95%'],
            fixed: false, //不固定
            shade:0.5,
            shadeClose:true,
            content: '/admin/team/getMember?memberCode='+memberCode,
        });
        return false;


    }
    function clickReplace(){
        //默认prompt
        layer.prompt({
            formType: 0,
            phone: '',
            title: '请输入手机号'
        },function(phone, index){
            var index = layer.open({
                title:'玩家信息',
                type: 2,
                area: ['95%', '95%'],
                fixed: false, //不固定
                shade:0.5,
                shadeClose:true,
                content: "/admin/team/getMember?teamId={$id}&phone="+phone,
            });
            return false;
        });
    }
    //单选框获取类型
    // 进入页面执行的方法
    $(function(){
    });
</script>
</body>
</html>